using System.Drawing;

namespace GeoSketch2.Core
{
    /// <summary>
    /// A class that contains the static variables for the application
    /// </summary>
    public static class Vars
    {
        /// <summary>
        /// A class that contains the mathematical constants for the application
        /// </summary>
        public static class Constants
        {
            /// <summary>
            /// The number PI
            /// </summary>
            public const double PI = 3.1415926535897932;
        }

        /// <summary>
        /// Test images
        /// </summary>
        public static class TestImages
        {
            /// <summary>
            /// An average size image
            /// </summary>
            public static string Img1600x1200Croix = "Images\\IMAGE_082.jpg";
            /// <summary>
            /// A big size image
            /// </summary>
            public static string Img4000x3000EtoileDeMer = "Images\\DSCF1945.jpg";
        }

        /// <summary>
        /// A class that contains the variables for the image rectification object
        /// </summary>
        public static class ImageRectification
        {
            /// <summary>
            /// Threshold for the detection of the cross (under the threshold the pixel doesn't belong to the cross anymore)
            /// </summary>
            public const byte CrossColorThreshold = 110;

            /// <summary>
            /// The radius of the blue cross (1000 mm)
            /// </summary>
            public const double BlueCrossRadius = 1000;

            /// <summary>
            /// The radius of the red cross (2000 mm)
            /// </summary>
            public const double RedCrossRadius = 2000;

            /// <summary>
            /// The radius of the green cross (500 mm)
            /// </summary>
            public const double GreenCrossRadius = 500;
        }

        /// <summary>
        /// A class that contains the variables for the drawings
        /// </summary>
        public static class Drawing
        {
            /// <summary>
            /// A class that contains the variables for the line style object object
            /// </summary>
            public static class LineStyle
            {
                /// <summary>
                /// Length of a dash
                /// </summary>
                public const float DashLength = 3f;

                /// <summary>
                /// Length of a space in a dashed line
                /// </summary>
                public const float DashSpaceLength = 3f;

                /// <summary>
                /// Length of a space in a dotted line
                /// </summary>
                public const float DotSpaceLength = 2f;
            }

            /// <summary>
            /// A class that contains the variables for the drawing of GeoObjects
            /// </summary>
            public static class GeoObjects
            {
                /// <summary>
                /// A class that contains the variables for the drawing of GeoPoint
                /// </summary>
                public static class GeoPoint2D
                {
                    /// <summary>
                    /// To draw or not the id of the point
                    /// </summary>
                    public static bool DrawId = false;

                    /// <summary>
                    /// The radius of the cross on the screen (pixels)
                    /// </summary>
                    public static float CrossRadius = 5f;

                    /// <summary>
                    /// The font of the id
                    /// </summary>
                    public static Font IdFont = new Font(FontFamily.GenericSansSerif, 12f);
                }

                /// <summary>
                /// A class that contains the variables for the drawing of GeoPoint
                /// </summary>
                public static class ArchaeoPoint2D
                {
                    /// <summary>
                    /// To draw or not the id of the point
                    /// </summary>
                    public static bool DrawId = false;

                    /// <summary>
                    /// The radius of the cross on the screen (pixels)
                    /// </summary>
                    public static float CrossRadius = 5f;

                    /// <summary>
                    /// The font of the id
                    /// </summary>
                    public static Font IdFont = new Font(FontFamily.GenericSansSerif, 12f);
                }
            }
        }

        /// <summary>
        /// A class that contains the variables for the setup
        /// </summary>
        public static class Setup
        {
            /// <summary>
            /// A class that contains the variables for the setup of GeoObjects
            /// </summary>
            public static class GeoObjects
            {
                /// <summary>
                /// The maximum distance to accept the object is near to the clic (pixels)
                /// </summary>
                public static double IsNearDistance = 5;

                /// <summary>
                /// The maximum distance to accept the object is near to the clic (pixels)
                /// </summary>
                public static Pen SelectionPen = new Pen(Color.Cyan, 3);

                /// <summary>
                /// The next available id for the GeoObject
                /// </summary>
                public static int NextAvailableId = 0;
            }

            /// <summary>
            /// The setup for the GeoSketch forms
            /// </summary>
            public static class GeoSketchForms
            {
                /// <summary>
                /// The setup of the image rectification form
                /// </summary>
                public static class ImageRectification
                {
                    /// <summary>
                    /// The active parent items for this form
                    /// </summary>
                    public static ActiveMDIParentItems ActiveParentItems = new ActiveMDIParentItems(false, false, false, false, false, true, false, false, false, false, false);
                }

                /// <summary>
                /// The setup of the drawing form
                /// </summary>
                public static class ArchaeoDrawing
                {
                    /// <summary>
                    /// The side length of the image of layer menu
                    /// </summary>
                    public static int MenuItemsImageSize = 20;

                    /// <summary>
                    /// The color of the layer menu item if the layer is invisible
                    /// </summary>
                    public static Color MenuItemsLayerInvisible = Color.Silver;

                    /// <summary>
                    /// The maximum number of layers to display in the menu
                    /// </summary>
                    public static int MaxLayersToDisplay = 15;

                    /// <summary>
                    /// The colors to display in the menu
                    /// </summary>
                    public static Color[] MenuColors = new Color[]{
                        Color.Black,
                        Color.Red,
                        Color.Blue,
                        Color.Green,
                        Color.Yellow,
                        Color.Orange,
                        Color.Violet,
                        Color.Cyan
                    };

                    /// <summary>
                    /// The image index for the excavation site in the treeview
                    /// </summary>
                    public static int TreeViewSiteImageIndex = 0;

                    /// <summary>
                    /// The image index for the excavation site in the treeview
                    /// </summary>
                    public static int TreeViewSquareImageIndex = 1;

                    /// <summary>
                    /// The image index for the excavation site in the treeview
                    /// </summary>
                    public static int TreeViewUnitImageIndex = 2;

                    /// <summary>
                    /// The image index for the excavation site in the treeview
                    /// </summary>
                    public static Color BackgroundColor = Color.White;

                    /// <summary>
                    /// The image index for the excavation site in the treeview
                    /// </summary>
                    public static Color ComplementRegionColor = Color.Silver;
                }
            }

            /// <summary>
            /// The setup for the GeoSketch tools
            /// </summary>
            public static class GeoTools
            {
                /// <summary>
                /// The setup for the zoom tool
                /// </summary>
                public static class GeoZoom
                {
                    /// <summary>
                    /// The zoom factor, for example 1/20, means that a displacement of the mouse by 20 pixels is needed
                    /// to zoom X2 (2^1), 40 pixels = 2^2= zoom X4
                    /// </summary>
                    public static double ZoomFactor = 1 / 20.0;

                    /// <summary>
                    /// The pen for the line
                    /// </summary>
                    public static Pen LinePen = new Pen(Color.Red, 2);

                    /// <summary>
                    /// The font of the text
                    /// </summary>
                    public static Font TextFont = new Font(FontFamily.GenericSansSerif, 12);

                    /// <summary>
                    /// The brush of the text
                    /// </summary>
                    public static Brush TextBrush = new SolidBrush(Color.Red);
                }

                /// <summary>
                /// The setup for the zoom tool 2
                /// </summary>
                public static class GeoZoom2
                {
                    /// <summary>
                    /// The zoom factor, the lower, the "slower" the zoom will be
                    /// </summary>
                    public static double ZoomFactor = 4;
                }

                /// <summary>
                /// The setup for the magnifier tool
                /// </summary>
                public static class GeoMagnifier
                {
                    /// <summary>
                    /// The zoom factor
                    /// </summary>
                    public static double ZoomFactor = 4;
                }

                /// <summary>
                /// The setup for the zoombox tool
                /// </summary>
                public static class GeoZoomBox
                {
                    /// <summary>
                    /// The pen of the sketch
                    /// </summary>
                    public static Pen SketchPen = new Pen(Color.Red, 2);

                }

                /// <summary>
                /// The setup for the selection tool
                /// </summary>
                public static class GeoSelection
                {
                    /// <summary>
                    /// The pen of the tool
                    /// </summary>
                    public static Pen SelectionPen = new Pen(Color.Red, 1);

                }

                /// <summary>
                /// The setup for the excavation squares creation tools
                /// </summary>
                public static class ArchaeoExcavationSquareCreation
                {
                    /// <summary>
                    /// The color of the bounds of a square
                    /// </summary>
                    public static Color LineColor = Vars.Setup.ArchaeoExcavationAreas.ArchaeoExcavationSite.ExcavationSquaresDisplayPen.Color;

                    /// <summary>
                    /// The line type of the bounds of a square
                    /// </summary>
                    public static LineType LineType = new LineType(LineStyle.Solid, 1f, 1f);
                }

                /// <summary>
                /// The setup for the excavation units creation
                /// </summary>
                public static class ArchaeoExcavationUnitCreation
                {
                    /// <summary>
                    /// The color of the bounds of a unit
                    /// </summary>
                    public static Color LineColor = Vars.Setup.ArchaeoExcavationAreas.ArchaeoExcavationSquare.ExcavationUnitsDisplayPen.Color;

                    /// <summary>
                    /// The line type of the bounds of a square
                    /// </summary>
                    public static LineType LineType = new LineType(LineStyle.Solid, 1f, 1f);
                }
            }

            /// <summary>
            /// The setup of standard object (primitives)
            /// </summary>
            public static class StandardObjects
            {
                /// <summary>
                /// The setup of layers
                /// </summary>
                public static class Layer
                {
                    /// <summary>
                    /// The next available display order, they must follow, no gap, 0 is the layer at the bottom, the max is the layer at the top
                    /// </summary>
                    public static int NextAvailableDisplayOrder = 0;
                }
            }

            /// <summary>
            /// The setup of the toolbars
            /// </summary>
            public static class Toolbars
            {
                /// <summary>
                /// The setup for the toolbar buttons
                /// </summary>
                public static class ToolbarButtons
                {
                    /// <summary>
                    /// The pen used to draw a half rectangle around the button when clicking left
                    /// </summary>
                    public static Pen LeftClickPen = new Pen(Color.Red, 3f);

                    /// <summary>
                    /// The pen used to draw a half rectangle around the button when clicking right
                    /// </summary>
                    public static Pen RightClickPen = new Pen(Color.Green, 3f);
                }

                /// <summary>
                /// The space between the button in the title bar
                /// </summary>
                public const int SpaceBetweenTitleButtons = 3;
            }

            /// <summary>
            /// The setup for the excavation areas
            /// </summary>
            public static class ArchaeoExcavationAreas
            {
                /// <summary>
                /// The setup for the excavation site
                /// </summary>
                public static class ArchaeoExcavationSite
                {
                    /// <summary>
                    /// The pen used to display the bounds of the squares in the site view
                    /// </summary>
                    public static Pen ExcavationSquaresDisplayPen = new Pen(Color.Red);
                    
                    /// <summary>
                    /// The font used to display the bounds of the squares in the site view
                    /// </summary>
                    public static Font NameFontdisplay = new Font(FontFamily.GenericSansSerif, 12f);
                }

                /// <summary>
                /// The setup for the excavation squares
                /// </summary>
                public static class ArchaeoExcavationSquare
                {
                    /// <summary>
                    /// The pen used to display the bounds of the units in the site view
                    /// </summary>
                    public static Pen ExcavationUnitsDisplayPen = new Pen(Color.Blue, 1f);

                    /// <summary>
                    /// The font used to display the bounds of the units in the site view
                    /// </summary>
                    public static Font NameFontdisplay = new Font(FontFamily.GenericSansSerif, 12f);
                }
            }

            /// <summary>
            /// The setup of GeoSketch
            /// </summary>
            public static class GeoSketch
            {
                /// <summary>
                /// The numberformat to define the decimal separator used in the program
                /// </summary>
                public static System.Globalization.NumberFormatInfo NumberFormat;

                /// <summary>
                /// The coordinates separator used the split the X and the Y coordinates in a string
                /// </summary>
                public const char CoordinatesSeparator = ';';
            }
        }
    }
}
